\subsection{Static Mapping}
\label{sec:StaticRules}

A first level of abstraction consists in mapping artifacts relevant to the policy to artifacts in the Java program. This mapping is static in the sense that it does not require the knowledge of how each part is executed, but rather declares mapping between both specifications. 


A \texttt{StaticMapping} is either a \texttt{RoleDeclaration} or an \texttt{ActionDeclaration}. A \texttt{RoleDeclaration} binds a \texttt{class} of the application to a \texttt{role} in the policy, meaning that each instance of \texttt{Class} will be recognised as having this \texttt{Role}. A list of optional \texttt{Field}s can be attached for performance purposes: only the relevant instance fields of this class will be monitored. An \texttt{ActionDeclaration} binds an \texttt{action} from the policy to a sequence of methods in the application. To ease further reference of the methods involved in the action's realisation, it is possible to define aliases, bind in the order of the methods sequence.

Static mappings usually have a textual concrete syntax, as depicted in the example below. The \texttt{RoleDeclaration} on the left binds the role \textsf{doctor} to the class \textsf{Doctor}, with a relevant instance field \textsf{patient\_name}. Note that the class name is fully qualified to avoid confusion, and that the fields' types are repeated in order to allow well-formedness rules to check consistency in other part of the \textsc{Dsl}. The \texttt{ActionDeclaration} on the right binds the action \textsf{delete\_file} to a sequence of two methods named \textsf{deleteFile}, aliased respectively to \textsf{deleteService} and \textsf{deleteDB}. Note also that methods are also given with their fully qualified name and their signature to uniquely identify them (because of possible method overloading \cite[Sec. 8.4]{B:Gosling-etAl}). 

\bigskip\noindent
\begin{minipage}{\textwidth}
	\begin{minipage}[t]{0.4\textwidth}
		\begin{small}
			\begin{sffamily}
\textbf{role} doctor\\
\textbf{class} \texttt{com.*.Person.Doctor}\\
\textbf{attributes} \texttt{ArrayList<String>:\\
\phantom{attributesss} patient\_names}
			\end{sffamily}
		\end{small}	
	\end{minipage}
	\hfill
	\begin{minipage}[t]{0.56\textwidth}
		\begin{small}
			\begin{sffamily}
\textbf{action} delete\_file\\
\textbf{methodId} deleteService, deleteDB\\
\textbf{sig} \texttt{*.Service.deleteFile(int, String, int)}\\
\phantom{s} \texttt{-> *.DB.deleteFile(File)}
			\end{sffamily}
		\end{small}
	\end{minipage}
\end{minipage}
